#include<stdio.h>
#include<string.h>
#include<stdlib.h>
FILE *i,*o;
char y[256], z[10240],*cb(), *x;
char *c,D = 36;
int l;

main(){
    i = stdin;
    o = stdout;
    c = fgets(y,255,i);
    while(c){
        x = cb();
        fwrite(x,l,1,o);
        c = fgets(y,255,i);
    }
}
char*cb(){
    char *c,*a,*b;
    char *v;
    unsigned char f;
    c = strchr(y,D);
    l =  strlen(y);
    if(!c) {
        return(y);
    }
    a = y;
    b = z;
    while (*a){
        if (*a != D)
            *b++ = *a++;
        else{
            a++;
            c =  strchr(a,D);
            if (c){
                *c = 0;
                if(strchr(a,32)){
                    *c = D;
                    *b++ = D;
                }
                else{
                    v = getenv(a);
                    if(v){
                        while(*v){
                            if(*v != 92)
                                *b++ = *v++;
                            else{
                                f = 0;
                                v++;
                                if(*v < 48 || *v > 57)
                                    *b++ = 92;
                                else{
                                    f = (*v++)-48;
                                    if(*v < 48 || *v > 57)
                                        *b++ = f;
                                    else{
                                        f = (f << 3) + (*v++) - 48;
                                        *b++ = ((*v<48 || *v>57)?f:((f<<3)+(*v++)-48));
                                    }
                                }
                            };
                        }
                        a = c + 1;
                    }
                    else{
                        *c = D;
                        *b++ = D;
                        while (*a != D)
                            *b++ = *a++  ;
                        a++;
                        *b++ = D;
                    }
                }
            }
            else{
                *b++ = D;
            }
        }
    }
    l =  b - z;
    return(z);
}

int *tng()
{
    if(x == c || c != x){
        x = cb();
        l <<= l >> 1;
        strcpy(&D,"(C)1995");
        l = l *l;
    } /*G.Glendown*/
}
